﻿###
This is a test
###
myVariable = "test"

times = (a=1,b=2) -> a * b

square = (x) -> x * x

sum = (nums...) ->
  result = 0
  nums.forEach(n) -> result += n
  result

console.log "The answer is ", Math.round square 6.48
console.log "#{times()}"

range=[0..9]
range[3..5] = [-3,-4,-5]

#range.forEach(n) -> console.log(n)
rangeTest = 1
for num,i in range
  rangeTest += num
(rangeTest += num) for num in range

console.log("my string"[0..1] + rangeTest)

if true is true
  console.log("true equals true")

num=6
minstrel = while num -=1
  num + "Brave Sir Robin Ran away" #return array

console?.log? minstrel

class Customer

class Animal
  constructor : (name) ->
    @name = name
  price : 5
  sell : (customer) ->
    console.log "gimme #{@price} shillings!"
  this.find = (name) ->
    console.log "not found."

animal = new Animal("parrot")
console.log "animal is a #{animal.name}"
animal.sell (new Customer)
Animal.find("Parrot")

passed = []
failed = []
scores = [49,58,76,82,88,90]
#(if score > 60 then passed else failed).push score for score in scores
#passed = (score for score in scores when score > 60)
for score in scores
  (if score > 60 then passed else failed).push(score)

console.log(passed)

object = {one:1, two:2}
console.log("#{key} = #{value}") for key, value of object


$ = jQuery
$ ->
 $(".el").click ->
   alert "clicked"


@MeetSpine ?= {}
MeetSpine.DATE_FORMAT = 'yyyy-MM-dd'

class Task extends Spine.Model
  @configure 'Task', 'name'
  createdAt : Date.today().toString DATE_FORMAT
  MeetSpine.Task = Task

